<?php

/**
 * Jour filter form base class.
 *
 * @package    sop
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseJourFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'date'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'worker_id'             => new sfWidgetFormFilterInput(),
      'type'                  => new sfWidgetFormFilterInput(),
      'semaine_id'            => new sfWidgetFormFilterInput(),
      'heure_arrivee'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'heure_depart'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'duree_pause'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'total_journee'         => new sfWidgetFormFilterInput(),
      'commentaire'           => new sfWidgetFormFilterInput(),
      'is_credit'             => new sfWidgetFormFilterInput(),
      'is_valide'             => new sfWidgetFormFilterInput(),
      'is_valide_responsable' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_deplact'            => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'date'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'worker_id'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'type'                  => new sfValidatorPass(array('required' => false)),
      'semaine_id'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'heure_arrivee'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'heure_depart'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'duree_pause'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'total_journee'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'commentaire'           => new sfValidatorPass(array('required' => false)),
      'is_credit'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_valide'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_valide_responsable' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_deplact'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('jour_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Jour';
  }

  public function getFields()
  {
    return array(
      'date'                  => 'Date',
      'worker_id'             => 'Number',
      'type'                  => 'Text',
      'semaine_id'            => 'Number',
      'heure_arrivee'         => 'Date',
      'heure_depart'          => 'Date',
      'duree_pause'           => 'Number',
      'total_journee'         => 'Number',
      'commentaire'           => 'Text',
      'is_credit'             => 'Number',
      'is_valide'             => 'Number',
      'is_valide_responsable' => 'Boolean',
      'is_deplact'            => 'Number',
      'id'                    => 'Number',
    );
  }
}
